home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / strpchrt.zip / USER.DOC < prev   
Text File  |  1993-08-03  |  84KB  |  2,665 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           PRINTING NOTES:
  8.  
  9.           This file is an ASCII  text file of the Strip Chart  Library user
  10.           manual.  It is about 45 pages long.
  11.  
  12.           Use a non-proportional font (example: Courier) and a font size of
  13.           12 points for best printing results.
  14.  
  15.           If  you are  importing  this file  to a  word  processor such  as
  16.           WordPerfect, set the word processor's top, bottom, left and right
  17.           margins to zero.
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.                                  STRIP CHART LIBRARY
  37.                                     USER'S MANUAL
  38.  
  39.  
  40.                                 Shareware Version 1.00
  41.                                       July, 1993
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.                                  Copyright (c) 1993 
  73.                                  Christopher Lim
  74.                                  517 Cobb Court
  75.                                  La Puente, California 91746
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.                                 COPYRIGHT INFORMATION
  85.  
  86.           Copyright (c) 1993 by Christopher S. Lim.  All rights reserved.
  87.           This is a shareware program.  Please refer to the READ.ME file
  88.           for registration, licensing and distribution information.
  89.  
  90.           The author makes no warranty of any kind with regard to the
  91.           program or documentation, including, but not limited to, the
  92.           implied warranties of merchantability and fitness for a
  93.           particular purpose.  The author shall not be liable in any event
  94.           for incidental or consequential damages in connection with, or
  95.           arising out of, the furnishing, performance, or use of the
  96.           program.
  97.  
  98.  
  99.  
  100.           TRADEMARKS
  101.  
  102.           Borland is a registered trademark of Borland International.
  103.           Epson LQ and Epson FX are registered trademarks of Seiko Epson
  104.              Corporation.
  105.           IBM is a registered trademark of International Business Machines.
  106.           Microsoft is a registered trademark of Microsoft Corporation.
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.                                   TABLE OF CONTENTS
  118.                                   =================
  119.  
  120.  
  121.           Chapter 1  Getting Started . . . . . . . . . . . . . . . . . .  1
  122.  
  123.           Chapter 2  Using the Strip Chart Library . . . . . . . . . . .  3
  124.  
  125.           Chapter 3  Library Reference . . . . . . . . . . . . . . . . .  8
  126.  
  127.           Chapter 4  Error Messages. . . . . . . . . . . . . . . . . . . 42
  128.  
  129.  
  130.  
  131.  
  132.  
  133.             
  134.             
  135.             
  136.                                   C H A P T E R   1
  137.             
  138.                                    Getting Started
  139.             
  140.             
  141.             INTRODUCTION
  142.             ============================================================
  143.             
  144.             *** NOTE: Please read the READ.ME file before doing anything
  145.                  else.
  146.             
  147.             The Strip Chart Library is a C printer graphics library for
  148.             plotting strip charts on inexpensive dot matrix printers.  A
  149.             strip chart is a continuous two-dimensional graph which
  150.             plots one or more traces (waveforms) versus time.  The Strip
  151.             Chart Library contains functions that mimic and even exceed
  152.             the most useful features of very costly strip chart
  153.             recorders:
  154.             
  155.                - Traces can be sized and placed anywhere on the chart.
  156.                - Traces may overlay or overlap other traces.
  157.                - Text and comments can be positioned anywhere on the
  158.                  chart.
  159.                - Reference time axes can be positioned anywhere on the
  160.                  chart.
  161.                - Events (high-low signals), with different marker types,
  162.                  are supported.
  163.                - Waveform grid display, clipping and axis labeling are
  164.                  supported.
  165.                - The number of channels is limited only by amount of
  166.                  memory.
  167.                - Virtually any  "plotting speed" may be simulated when
  168.                  playing back previously acquired data.
  169.  
  170.  
  171.             SYSTEM REQUIREMENTS
  172.             ============================================================
  173.             
  174.             Computer Hardware and Software
  175.             ------------------------------
  176.             The Strip Chart Library was designed and tested for IBM PC
  177.             compatible computers running the DOS operating system.  A 25
  178.             Mhz 80386 or faster PC is highly recommended.
  179.             
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.                                           1
  187.  
  188.  
  189.  
  190.  
  191.  
  192.             Supported Compilers
  193.             -------------------
  194.             The libraries were compiled with the following compilers:
  195.             
  196.                SCBCS.LIB   Borland C/C++ Version 3.1 (Small Memory
  197.                            Model)
  198.             
  199.                SCMSS.LIB   Microsoft C/C++ Version 7.0 (Small Memory
  200.                            Model)
  201.  
  202.             If you use a different compiler or need a different memory
  203.             model, you will have to recompile the library source code.
  204.             Library source code is available to registered users.  Please
  205.             refer to the READ.ME file for registration information.
  206.  
  207.             Supported Printers
  208.             ------------------
  209.             The Strip Chart Library supports the following tractor feed
  210.             dot-matrix printers:
  211.             
  212.                  Epson FX (9-pin) or compatible dot matrix printers
  213.                  Epson LQ (24-pin) or compatible dot matrix printers
  214.             
  215.             Both the narrow and wide carriage versions of the above
  216.             printers are supported.  Color printers are currently not
  217.             supported.  To improve performance, a large printer buffer
  218.             is recommended.
  219.             
  220.             
  221.             PRINTER SETUP
  222.             ============================================================
  223.             
  224.             The printer must be set up as follows:
  225.             
  226.                Printer Mode:  EPSON COMPATIBLE
  227.                Auto Line Feed:  OFF
  228.                Paper Feed Type:  TRACTOR FEED 
  229.                Paper-Out Sensor: ON
  230.                Print Direction For Graphics (24 pin only):  UNIDIRECT
  231.                Skip Over Perforation:  OFF
  232.             
  233.             NOTE:  Most of the above functions are normally set through
  234.             the printer dip switch settings; consult your printer manual
  235.             on how to do this.  You may need to experiment with the
  236.             other dip switches and user-settable functions of the
  237.             printer to get the best output.  Run the sample test
  238.             programs to the check the quality of printer output.
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.                                           2
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.             
  253.             
  254.                                   C H A P T E R   2
  255.             
  256.                             Using the Strip Chart Library
  257.             
  258.             
  259.             OVERVIEW
  260.             ============================================================
  261.             
  262.             This section presents a brief summary of the functions
  263.             available in the Strip Chart Library.  For more detailed
  264.             information about these functions, consult Chapter 3,
  265.             Library Reference.
  266.             
  267.             The Strip Chart Library uses an objected-oriented approach
  268.             for creating and plotting strip charts:  you control the
  269.             appearance of the strip chart by adding windows to the
  270.             paper and display data by adding the desired data values to
  271.             each window.  The library takes care of the details of
  272.             plotting the data.
  273.             
  274.             Writing a program with the Strip Chart Library consists of
  275.             five steps:  Planning the Strip Chart, Initializing the
  276.             Strip Chart, Adding Windows to the Strip Chart, Adding Data
  277.             to the Windows, Terminating the Strip Chart.  The following
  278.             sections cover these steps in more detail.
  279.             
  280.             Include File
  281.             ------------
  282.             Only one include file, SC.H, is required for every C source
  283.             file that calls a function from the Strip Chart Library.
  284.             
  285.             Error Handling
  286.             --------------
  287.             Error conditions in the Strip Chart Library are handled in
  288.             two ways:  (1) through calling an error trap function
  289.             defined by SC_SetErrorTrap, and (2) through returning a non-
  290.             zero error code (a zero value indicates no error) by most
  291.             functions in the Strip Chart Library.  Using SC_SetErrorTrap
  292.             is the easier and preferred method; however, the error
  293.             return code is useful for pinpointing which portion of your
  294.             code committed the error.  The nature of the error can be
  295.             examined by calling function SC_ErrorMsg.  If an error
  296.             condition occurs, it is strongly suggested that you
  297.             immediately terminate or reinitialize the Strip Chart
  298.             Library as unpredictable results could occur if you continue
  299.             with the program.
  300.             
  301.             
  302.             
  303.  
  304.                                           3
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.             PLANNING THE STRIP CHART
  312.             ============================================================
  313.             
  314.             Windows and Page Layout
  315.             -----------------------
  316.             Carefully plan the layout of the strip chart.  Divide the
  317.             strip chart into windows.  A window is a rectangular area on
  318.             the strip chart of fixed height and potentially infinite
  319.             length.  There are five types of windows:
  320.             
  321.                  "Event Windows" accept and display event (two-state or
  322.                  high-low) signal levels.
  323.             
  324.                  "Text Windows" accept and display messages.
  325.             
  326.                  "Time Windows" display reference time axes.
  327.             
  328.                  "Title Windows" accept and display a fixed string at
  329.                  specified intervals.
  330.             
  331.                  "Trace Windows" accept and plot waveforms.
  332.             
  333.             Units of Measure
  334.             ----------------
  335.             Decide whether you want to use either English units (in
  336.             inches) or Metric units (in centimeters) to describe plot
  337.             length dimensions such as character height, window height
  338.             and window offset.  You specify the type of unit to use in
  339.             function SC_Init.
  340.             
  341.             Decide on the basic time unit you will use.  For most cases,
  342.             you will probably be using seconds as the basic time unit. 
  343.             However you may choose any other measurement of time such as
  344.             minutes, hours, or even weeks or months.   To keep
  345.             terminology simple in this manual, we will assume that you
  346.             will be using seconds as the basic time unit.
  347.              
  348.             Trace data are specified in real world coordinates (for
  349.             example, in volts).  When you create a Trace Window, you
  350.             specify the maximum and minimum amplitudes in real world
  351.             coordinates that correspond to the top and bottom of the Trace
  352.             Window.  See the descriptions for function SC_AddTraceWindow
  353.             and SC_Trace in Chapter 3 for more information.
  354.  
  355.             Plot Speed
  356.             ----------
  357.             Plot speed does not refer to the actual speed of paper or
  358.             chart movement but to the relationship of the chart's
  359.             horizontal dimension to the basic time unit.  For example,
  360.             if you select a plot speed of 2 inches per second, two
  361.             inches measured along the horizontal (long side) of the
  362.  
  363.                                           4
  364.  
  365.  
  366.  
  367.  
  368.  
  369.             chart is equivalent to 1 second of time.  You specify the
  370.             plot speed in function SC_Init.
  371.             
  372.             
  373.             INITIALIZING THE STRIP CHART LIBRARY
  374.             ============================================================
  375.             
  376.             Here is a summary of the functions used to initialize the
  377.             Strip Chart Library:
  378.             
  379.                SC_Init             Initializes the Strip Chart Library
  380.                                    and the printer.  Except for
  381.                                    functions SC_SetErrorTrap and
  382.                                    SC_PrinterReady, SC_Init must be
  383.                                    called prior to any other function in
  384.                                    the Strip Chart Library.
  385.             
  386.                SC_SetErrorTrap     Specifies a function to trap errors.
  387.             
  388.                SC_PrinterReady     Checks if the printer is on-line and
  389.                                    ready to receive data.
  390.             
  391.             
  392.             ADDING WINDOWS TO THE STRIP CHART
  393.             ============================================================
  394.             
  395.             After initialization, the next step is to add windows to the
  396.             strip chart.  Adding windows consists of calling a
  397.             SC_Add???Window function with the window position (yoffset),
  398.             window height (yheight), and other window-specific control
  399.             flags as arguments.  Windows may be positioned anywhere
  400.             within the physical dimension of the paper; it is
  401.             permissible to have overlapping windows.  The number of
  402.             windows that may be added is limited only by available
  403.             memory on your computer.  The SC_Add???Window function, on
  404.             success, returns a pointer (SC_WINDOW *) that is used to
  405.             identify the window in subsequent operations.  Below is the
  406.             summary of the functions to add windows:
  407.             
  408.                SC_AddEventWindow   Adds an Event Window to the strip
  409.                                    chart.
  410.                
  411.                SC_AddTextWindow    Adds a Text Window to the strip
  412.                                    chart.  The height of the window
  413.                                    determines the character height.
  414.                
  415.                SC_AddTimeWindow    Adds a Time Window to the strip
  416.                                    chart.  Time Windows consist of two
  417.                                    subwindows of equal height:  one
  418.                                    subwindow contains the horizontal
  419.                                    axis and time tick marks, and a
  420.                                    second subwindow to display text
  421.  
  422.                                           5
  423.  
  424.  
  425.  
  426.  
  427.  
  428.                                    labels.
  429.             
  430.                SC_AddTitleWindow   Adds a Title Window to the strip
  431.                                    chart.  Character height is equal to
  432.                                    the window height.
  433.             
  434.                SC_AddTraceWindow   Adds a Trace Window to the strip
  435.                                    chart.
  436.             
  437.             
  438.             Controlling the Appearance of Trace Windows
  439.             -------------------------------------------
  440.             The following functions control the appearance of Trace
  441.             Windows:
  442.             
  443.                SC_SetHorizontalGrids Controls the number of horizontal
  444.                                      grids in Trace Windows.
  445.                  
  446.                SC_SetTimeGrids       Controls the frequency of timing
  447.                                      grids in Trace Windows.
  448.             
  449.                SC_SetYlabels         Controls the appearance of vertical
  450.                                      axis labels in Trace Windows.
  451.             
  452.             The above functions only affect Trace Windows added later. 
  453.             Trace Windows that were created before calling any of the
  454.             above functions are not affected.
  455.             
  456.             
  457.             ADDING DATA TO STRIP CHART WINDOWS
  458.             ============================================================
  459.             
  460.             After the Strip Chart Library has been initialized and
  461.             windows added to the strip chart, data can now be displayed
  462.             in the windows.  The following functions are used to add and
  463.             display data in the windows:
  464.             
  465.                SC_Event       Sets the event level (0 or 1) in an Event
  466.                               Window.
  467.             
  468.                SC_Text        Adds a character string to a Text Window.
  469.             
  470.                SC_Title       Sets the title message in a Title Window.
  471.             
  472.                SC_Trace       Sets the trace amplitude in a Trace
  473.                               Window.
  474.             
  475.                SC_Draw        Plots the contents of all windows up to
  476.                               the current time position to an internal
  477.                               printer buffer.  SC_Draw should only be
  478.                               called after all windows are updated to
  479.                               the current time position.
  480.  
  481.                                           6
  482.  
  483.  
  484.  
  485.  
  486.  
  487.             
  488.                SC_Advance     Advances the paper to the next time
  489.                               position.
  490.             
  491.             Functions SC_Event, SC_Text, SC_Title and SC_Trace add data
  492.             to their respective windows at the current time position. 
  493.             Calling SC_Draw is a signal to the Strip Chart Library that
  494.             you have finished adding data to all windows for the current
  495.             time position and the Library will proceed to plot the data. 
  496.             The SC_Advance function moves the chart to the next time
  497.             position after which the Library is ready to accept more
  498.             data.   It must be stressed that SC_Draw must be called
  499.             after data are added all windows and before calling
  500.             SC_Advance to advance the paper.
  501.             
  502.             There are special cases where multiple calls to SC_Draw are
  503.             required before calling SC_Advance.  One example involves
  504.             Trace Windows displaying step functions or square waves; see
  505.             the example in file EX_STEP.C.
  506.              
  507.             
  508.             TERMINATING THE STRIP CHART
  509.             ============================================================
  510.             
  511.             To terminate the strip chart, call function SC_Close:
  512.             
  513.                SC_Close    Closes the Strip Chart Library.  All windows
  514.                            are closed, the contents of internal buffers
  515.                            are flushed, and memory allocated by the
  516.                            Strip Chart Library are released.
  517.             
  518.               
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.                                           7
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.             
  548.             
  549.                                   C H A P T E R   3
  550.             
  551.                                   Library Reference
  552.             
  553.             
  554.             
  555.             SC_AddEventWindow
  556.             ============================================================
  557.             
  558.                Adds an Event Window to the strip chart.
  559.             
  560.             SYNTAX
  561.             
  562.                #include "sc.h"
  563.                SC_WINDOW *SC_AddEventWindow(double yoffset, 
  564.                  double yheight, int markerType, int fillType, 
  565.                  int *error);
  566.             
  567.             RETURN VALUE
  568.             
  569.                On success, SC_AddEventWindow returns a pointer to the
  570.                window.  In the event of an error, it returns NULL.
  571.             
  572.             REMARKS
  573.             
  574.                  yoffset [in] is the distance (in inches or centimeters)
  575.                  from the top of the strip chart to the top of the Event
  576.                  Window.  yoffset must be greater than zero.
  577.             
  578.                  yheight [in] is the window height in inches or
  579.                  centimeters.
  580.             
  581.                  markerType [in] is the type of event marker.  An event
  582.                  marker is used to display the state or level of a
  583.                  binary (two-state or high-low) signal.  Four types of
  584.                  event markers are available:               
  585.             
  586.                  SCM_PULSE--Event levels are displayed by high-low
  587.                     pulses.
  588.             
  589.                  SCM_TICK--Event level changes are displayed by
  590.                     vertical tick marks.
  591.             
  592.                  SCM_BAR--The high level is represented by bars.
  593.             
  594.                  SCM_BARLINE--Same as SCM_BAR except with a baseline
  595.                     added.
  596.             
  597.                  fillType [in] specifies the fill type for SCM_BAR or
  598.  
  599.                                           8
  600.  
  601.  
  602.  
  603.  
  604.  
  605.                  SCM_BARLINE event markers.  Three fill types are
  606.                  available:
  607.                  
  608.                     NO_FILL--Bars are not shaded.
  609.                     HALF_FILL--Bars are lightly shaded with dots.
  610.                     SOLID_FILL--Bars are fully shaded.
  611.             
  612.                  error [out] is a pointer to an error code.  A non-zero
  613.                  error code indicates an error condition.
  614.             
  615.             SEE ALSO
  616.             
  617.                SC_Event, SC_yoffset
  618.             
  619.             EXAMPLE
  620.             
  621.             #include <stdio.h>
  622.             #include <stdlib.h>
  623.             #include "sc.h"
  624.             
  625.             int main(void)
  626.             {
  627.                int i;
  628.                int error;
  629.                SC_WINDOW *eventWindow;
  630.             
  631.                /* Initialize: 8.5 inch wide paper, plot speed = 1
  632.                 inch/second */
  633.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  634.                 &error);
  635.             
  636.                /* Add Event Window 0.5" from top of paper, 0.25 inch
  637.                 window height, use pulse event markers
  638.                */
  639.                eventWindow = SC_AddEventWindow(0.5, 0.25, SCM_PULSE,
  640.                 NO_FILL, &error);
  641.             
  642.                /* Draw events */
  643.                for (i=0; i < 10; i++) /* 10 second plot */
  644.                {
  645.                   if ((i%2) == 0)
  646.                      SC_Event(eventWindow, 0, &error); /* set event low
  647.                                                         */
  648.                   else
  649.                      SC_Event(eventWindow, 1, &error); /* set event high
  650.                                                         */
  651.             
  652.                   SC_Draw();
  653.                   SC_Advance(1.0); /* one second steps */
  654.                }
  655.             
  656.                SC_Close();
  657.  
  658.                                           9
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                return 0;
  665.             }
  666.             
  667.             
  668.             
  669.             SC_AddTextWindow
  670.             ============================================================
  671.             
  672.                Adds a Text Window to the strip chart.
  673.             
  674.             SYNTAX
  675.             
  676.                #include "sc.h"
  677.                SC_WINDOW *SC_AddTextWindow(double yoffset, 
  678.                  double yheight, int *error);
  679.             
  680.             RETURN VALUE
  681.             
  682.                On success, SC_AddTextWindow returns a pointer to the
  683.                window.  In the event of an error, it returns NULL.
  684.             
  685.             REMARKS
  686.             
  687.                  yoffset [in] is the distance (in inches or centimeters)
  688.                  from the top of the strip chart to the top of the Text
  689.                  Window.  yoffset must be greater than zero.
  690.             
  691.                  yheight [in] is the window height in inches or
  692.                  centimeters.  The character height is equal to the
  693.                  window height.
  694.             
  695.                  error [out] is a pointer to an error code.  A non-zero
  696.                  error code indicates an error condition.
  697.             
  698.             SEE ALSO
  699.             
  700.                SC_Text, SC_yoffset
  701.             
  702.             EXAMPLE
  703.             
  704.             #include <stdio.h>
  705.             #include <stdlib.h>
  706.             #include "sc.h"
  707.             
  708.             int main(void)
  709.             {
  710.                int i;
  711.                int error;
  712.                SC_WINDOW *textWindow;
  713.             
  714.  
  715.  
  716.  
  717.                                           10
  718.  
  719.  
  720.  
  721.  
  722.  
  723.                /* Initialize: 8.5 inch wide paper, plot speed = 1
  724.                 inch/second */
  725.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  726.                 &error);
  727.             
  728.                if (error)
  729.                {
  730.                   printf("%s\n",SC_ErrorMsg(error));
  731.                   return 1; /* exit */
  732.                }
  733.             
  734.                /* Add Text Window 1.5" from top of paper, 
  735.                 0.25" window height
  736.                */
  737.                textWindow = SC_AddTextWindow(1.5, 0.25, &error);
  738.             
  739.                /* Draw */
  740.                for (i=0; i < 10; i++) /* 10 second plot */
  741.                {
  742.                   /* Display "hello world" every 2 seconds */
  743.                   if ((i%2) == 0)
  744.                      SC_Text(textWindow,"Hello World!",&error);
  745.                   SC_Draw();
  746.                   SC_Advance(1.0); /* one second steps */
  747.                }
  748.             
  749.                SC_Close();
  750.                return 0;
  751.             }
  752.             
  753.             
  754.             
  755.             SC_AddTimeWindow
  756.             ============================================================
  757.             
  758.                Adds a Time Window to the strip chart.
  759.             
  760.             SYNTAX
  761.             
  762.                #include "sc.h"
  763.                SC_WINDOW *SC_AddTimeWindow(double yoffset, 
  764.                  double yheight, int type,
  765.                  double tickInterval, int minorDiv,
  766.                  char * (*userFunc)(SC_WINDOW *timeWindow, 
  767.                      double elapsedTime, unsigned long labelCount),
  768.                  int *error);
  769.             
  770.             RETURN VALUE
  771.             
  772.                On success, SC_AddTimeWindow returns a pointer to the
  773.                window.  In the event of an error, it returns null.
  774.             
  775.  
  776.                                           11
  777.  
  778.  
  779.  
  780.  
  781.  
  782.             REMARKS
  783.             
  784.                  yoffset [in] is the distance (in inches or centimeters)
  785.                  from the top of the strip chart to the top of the Time
  786.                  Window.  yoffset must be greater than zero.
  787.             
  788.                  yheight [in] is the window height in inches or
  789.                  centimeters.  The character height of the labels is
  790.                  approximately one-half  the window height.  The height
  791.                  of the major tick marks is approximately one-half the
  792.                  window height.
  793.             
  794.                  type [in] specifies the type of the time window.  There
  795.                  are two types of time windows:
  796.             
  797.                     LABELS_BELOW_AXIS--Time labels are placed below the
  798.                     time axis.  Time tick marks are pointing upward. 
  799.             
  800.                     LABELS_ABOVE_AXIS--Time labels are placed above the
  801.                     time axis.  Time tick marks are pointing downward.
  802.             
  803.                  tickInterval [in] specifies the time interval (in
  804.                  seconds) between major tick marks.
  805.             
  806.                  minorDiv [in] specifies the number of minor divisions
  807.                  between major tick marks.
  808.             
  809.                  userFunc [in] is a user-defined function to create the
  810.                  string label to be placed at the major tick marks. 
  811.                  userFunc returns a pointer to the label string.  At
  812.                  every major tick interval, userFunc is called by the
  813.                  library and passed the following arguments:
  814.                
  815.                     timeWindow--This is a pointer to the Time Window
  816.                     where the label will be placed.  If you have more
  817.                     than one Time Window in your strip chart, you can
  818.                     specify the same userFunc for each Time Window and
  819.                     check the timeWindow argument to tell which Time
  820.                     Window is about to be labeled.
  821.             
  822.                     elapsedTime--This is the elapsed time (in seconds)
  823.                     from the start of the plot.  The first major tick
  824.                     mark always occurs at the very beginning of the plot
  825.                     where userFunc is called with elapsedTime set to
  826.                     0.0.
  827.             
  828.                     labelCount--This is the number of labels that has
  829.                     been printed for this Time Window.  The first major
  830.                     tick mark always occurs at the very beginning of the
  831.                     plot where userFunc is called with labelCount set to
  832.                     0.  The relationship between labelCount and
  833.                     elapsedTime is:
  834.  
  835.                                           12
  836.  
  837.  
  838.  
  839.  
  840.  
  841.             
  842.                       elapsedTime = labelCount * tickInterval.
  843.             
  844.                  error [out] is a pointer to an error code.  A non-zero
  845.                  error code indicates an error condition.
  846.             
  847.             EXAMPLE
  848.             
  849.             #include <stdio.h>
  850.             #include <stdlib.h>
  851.             #include "sc.h"
  852.             
  853.             char *LabelFunc(SC_WINDOW *w, double elapsedTime, unsigned
  854.                 long labelCount)
  855.             { /* user function to handle time axis labels */
  856.                static char buf[80]; /* string buffer must be declared as
  857.                                        static */
  858.                sprintf(buf,"%05.2f",elapsedTime); /* elapsedTime is in
  859.                                                      seconds */
  860.                return buf;
  861.             }
  862.             
  863.             int main(void)
  864.             {
  865.                int i;
  866.                int error;
  867.                SC_WINDOW *timeWindow;
  868.             
  869.                /* Initialize: 8.5 inch wide paper, 
  870.                 plot speed = 1 inch/second */
  871.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  872.                 &error);
  873.             
  874.                /* Add Time Window 1.0" from top of paper, 
  875.                 0.25" window height,
  876.                   labels above time axis, label every 2 seconds, 
  877.                 5 divisions between labels.
  878.                */
  879.                timeWindow = SC_AddTimeWindow(1.0, 0.25,
  880.                 LABELS_ABOVE_AXIS, 2.0, 5, LabelFunc, &error);
  881.             
  882.                /* Draw */
  883.                for (i=0; i < 10; i++) /* 10 second plot */
  884.                {
  885.                   SC_Draw();
  886.                   SC_Advance(1.0); /* one second steps */
  887.                }
  888.             
  889.                SC_Close();
  890.                return 0;
  891.             }
  892.             
  893.  
  894.                                           13
  895.  
  896.  
  897.  
  898.  
  899.  
  900.             
  901.             
  902.             SC_AddTitleWindow
  903.             ============================================================
  904.             
  905.                Adds a Title Window to the strip chart.
  906.             
  907.             SYNTAX
  908.             
  909.                #include "sc.h"
  910.                SC_WINDOW *SC_AddTitleWindow(double yoffset, 
  911.                  double yheight, double interval, int *error);
  912.             
  913.             RETURN VALUE
  914.             
  915.                On success, SC_AddTitleWindow returns a pointer to the
  916.                window.  In the event of an error, it returns null.
  917.             
  918.             REMARKS
  919.             
  920.                  yoffset [in] is the distance (in inches or centimeters)
  921.                  from the top of the strip chart to the top of the Title
  922.                  Window.  yoffset must be greater than zero.
  923.             
  924.                  yheight [in] is the window height in inches or
  925.                  centimeters.  The character height is equal to the
  926.                  window height.
  927.             
  928.                  interval [in] is the time interval (in seconds) for
  929.                  displaying the title string.
  930.             
  931.                  error [out] is a pointer to an error code.  A non-zero
  932.                  error code indicates an error condition.
  933.             
  934.             SEE ALSO
  935.             
  936.                SC_Title, SC_yoffset
  937.             
  938.             EXAMPLE
  939.             
  940.             #include <stdio.h>
  941.             #include <stdlib.h>
  942.             #include "sc.h"
  943.             
  944.             int main(void)
  945.             {
  946.                int i;
  947.                int error;
  948.                SC_WINDOW *titleWindow;
  949.             
  950.  
  951.  
  952.  
  953.                                           14
  954.  
  955.  
  956.  
  957.  
  958.  
  959.                /* Initialize: 8.5 inch wide paper, 
  960.                 plot speed = 1 inch/second */
  961.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  962.                  &error);
  963.             
  964.                /* Add Title Window 5.5" from top of paper, 
  965.                   0.25" window height,
  966.                   display every 2.0 seconds
  967.                */
  968.                titleWindow = SC_AddTitleWindow(5.5, 0.25, 2.0, &error);
  969.             
  970.                /* Set title string. */
  971.                SC_Title(titleWindow, "Hello World!", &error);
  972.             
  973.                /* Draw */
  974.                for (i=0; i < 10; i++) /* 10 second plot */
  975.                {
  976.                   SC_Draw();
  977.                   SC_Advance(1.0); /* one second steps */
  978.                }
  979.             
  980.                SC_Close();
  981.                return 0;
  982.             }
  983.             
  984.             
  985.             
  986.             SC_AddTraceWindow
  987.             ============================================================
  988.             
  989.                Adds a Trace Window to the strip chart.
  990.             
  991.             SYNTAX
  992.             
  993.                #include "sc.h"
  994.                SC_WINDOW *SC_AddTraceWindow(double yoffset,
  995.                  double yheight, double ymin, double ymax, 
  996.                  unsigned int flags, int *error);
  997.             
  998.             RETURN VALUE
  999.             
  1000.                On success, SC_AddTraceWindow returns a pointer to the
  1001.                window.  In the event of an error, it returns null.
  1002.             
  1003.             REMARKS
  1004.             
  1005.                  yoffset [in] is the distance (in inches or centimeters)
  1006.                  from the top of the strip chart to the top of the Trace
  1007.                  Window.  yoffset must be greater than zero.
  1008.             
  1009.                  yheight [in] is the window height in inches or
  1010.                  centimeters.
  1011.  
  1012.                                           15
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.             
  1019.                  ymin [in] is the real world Y coordinate corresponding
  1020.                  to the bottom border of the Trace Window.
  1021.             
  1022.                  ymax [in] is the real world Y coordinate corresponding
  1023.                  to the top border of the Trace Window.  The values of
  1024.                  ymin and ymax may be changed dynamically at any time by
  1025.                  calling the SC_SetTraceRange function.
  1026.             
  1027.                  flags [in]  are flags that control the appearance of
  1028.                  the trace window.  Flags may be combined with the use
  1029.                  of the C bitwise OR ("|") operator.
  1030.             
  1031.                     SCF_NOFLAGS--Disables all flags.
  1032.             
  1033.                     SCF_BORDER--Adds a border around the window.
  1034.                
  1035.                     SCF_GRID--Adds horizontal and vertical grids. 
  1036.                     Vertical (time) grid spacing are set through the
  1037.                     SC_SetTimeGrids function.  Horizontal grid spacing
  1038.                     are set through the SC_SetHorizontalGrids function. 
  1039.                     The SC_SetTimeGrids and SC_SetHorizontalGrids
  1040.                     functions must be called before calling
  1041.                     SC_AddTraceWindow.
  1042.             
  1043.                     SCF_YLABEL--Adds labels to the Y axis.  The format
  1044.                     of the labels can be specified through the
  1045.                     SC_SetYlabels function.  SC_SetYlabels must be
  1046.                     called prior to calling SC_AddTraceWindow.
  1047.             
  1048.                     SCF_CLIP--Segments outside the window are clipped.
  1049.                     If a segment is clipped, a thick solid line is drawn
  1050.                     at the top or bottom border where clipping occurs.
  1051.             
  1052.                  error [out] is a pointer to an error code.  A non-zero
  1053.                  error code indicates an error condition.
  1054.             
  1055.             SEE ALSO
  1056.             
  1057.                SC_SetHorizontalGrids, SC_SetTimeGrids, SC_SetTraceRange,
  1058.                SC_SetYlabels, SC_Trace, SC_yoffset
  1059.             
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.                                           16
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.             EXAMPLE
  1078.             
  1079.             #include <stdio.h>
  1080.             #include <stdlib.h>
  1081.             #include "sc.h"
  1082.             
  1083.             int main(void)
  1084.             {
  1085.                int i;
  1086.                int error;
  1087.                double y;
  1088.                SC_WINDOW *traceWindow;
  1089.             
  1090.                /* Initialize: 8.5 inch wide paper, 
  1091.                 plot speed = 1 inch/second */
  1092.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1093.                 &error);
  1094.             
  1095.                /* Set timing (vertical) grids to be 1 second apart. */
  1096.                SC_SetTimeGrids(1.0, &error);
  1097.             
  1098.                /* Set Y label format; display at 2.0 second intervals.
  1099.                 */
  1100.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  1101.             
  1102.                /* Divide trace into 4 equal sections. */
  1103.                SC_SetHorizontalGrids(4, &error);
  1104.             
  1105.                /* Add Trace Window 2.5" from top of paper, 
  1106.                 1.0" window height,
  1107.                 amplitude range from -1.0 to 1.0, display borders,
  1108.                 display grids, label Y axis.
  1109.                */
  1110.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  1111.                 -2.0, 2.0, SCF_BORDER | SCF_GRID | SCF_YLABEL,
  1112.                 &error);
  1113.             
  1114.                /* Draw a triangle wave of amplitude 2.0 */
  1115.                y = 2.0;
  1116.                for (i=0; i < 10; i++) /* 10 second plot */
  1117.                {
  1118.                   SC_Trace(traceWindow, y, &error);
  1119.                   y = y * -1.0;
  1120.                   SC_Draw();
  1121.                   SC_Advance(1.0); /* one second steps */
  1122.                }
  1123.             
  1124.                SC_Close();
  1125.                return 0;
  1126.             }
  1127.             
  1128.             
  1129.  
  1130.                                           17
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.             
  1137.             SC_Advance
  1138.             ============================================================
  1139.             
  1140.                Advances the paper.
  1141.             
  1142.             SYNTAX
  1143.             
  1144.                #include "sc.h"
  1145.                void SC_Advance(double interval);
  1146.             
  1147.             REMARKS
  1148.             
  1149.                interval [in] is the time interval (in seconds) to
  1150.                advance the paper.  Function SC_Draw should normally be
  1151.                called before calling SC_Advance.
  1152.             
  1153.             SEE ALSO
  1154.             
  1155.                SC_Draw
  1156.             
  1157.             EXAMPLE
  1158.             
  1159.             #include <stdio.h>
  1160.             #include <stdlib.h>
  1161.             #include "sc.h"
  1162.             
  1163.             int main(void)
  1164.             {
  1165.                int i;
  1166.                int error;
  1167.                double y;
  1168.                SC_WINDOW *traceWindow;
  1169.             
  1170.                /* Initialize: 8.5 inch wide paper, 
  1171.                   plot speed = 1 inch/second */
  1172.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1173.                 &error);
  1174.             
  1175.                /* Add Trace Window 2.5" from top of paper, 
  1176.                   1.0" window height,
  1177.                   amplitude range from -1.0 to 1.0, display borders.
  1178.                */
  1179.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  1180.                   -2.0, 2.0, SCF_BORDER, &error);
  1181.             
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.                                           18
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.                /* Draw a triangle wave of amplitude 2.0 */
  1196.                y = 2.0;
  1197.                for (i=0; i < 10; i++) /* 10 second plot */
  1198.                {
  1199.                   SC_Trace(traceWindow, y, &error);
  1200.                   y = y * -1.0;
  1201.                   SC_Draw(); /* display y */
  1202.                   SC_Advance(1.0); /* advance to next position, 
  1203.                 one second steps */
  1204.                }
  1205.             
  1206.                SC_Close();
  1207.                return 0;
  1208.             }
  1209.             
  1210.             
  1211.             
  1212.             SC_Close
  1213.             ============================================================
  1214.             
  1215.                Closes the Strip Chart Library.
  1216.             
  1217.             SYNTAX
  1218.             
  1219.                #include "sc.h"
  1220.                void SC_Close(void);
  1221.             
  1222.             REMARKS
  1223.             
  1224.                SC_Close signals the end of the strip chart.  The
  1225.                contents of internal buffers are flushed, and memory
  1226.                allocated by the Strip Chart Library are released.
  1227.             
  1228.             SEE ALSO
  1229.             
  1230.                SC_Init
  1231.             
  1232.             EXAMPLE
  1233.             
  1234.             #include <stdio.h>
  1235.             #include <stdlib.h>
  1236.             #include "sc.h"
  1237.             
  1238.             int main(void)
  1239.             {
  1240.                int error;
  1241.             
  1242.                /* Initialize: 8.5 inch wide paper, 
  1243.                   plot speed = 1 inch/second */
  1244.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1245.                 &error);
  1246.             
  1247.  
  1248.                                           19
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.                /*
  1255.                      Program body
  1256.                         :
  1257.                         :
  1258.             
  1259.                */
  1260.             
  1261.                SC_Close(); /* close the Strip Chart Library */
  1262.                return 0;
  1263.             }
  1264.             
  1265.             
  1266.             
  1267.             SC_Draw
  1268.             ============================================================
  1269.             
  1270.                Plots the contents of all windows up to the current time 
  1271.                position.
  1272.             
  1273.             SYNTAX
  1274.             
  1275.                #include "sc.h"
  1276.                void SC_Draw(void);
  1277.             
  1278.             REMARKS
  1279.             
  1280.                SC_Draw plots the contents of all windows up to the
  1281.                current time position to an internal printer buffer. 
  1282.                Actual printing is done only after this printer buffer is
  1283.                filled.  SC_Draw is normally called immediately before
  1284.                the SC_Advance function to flush the window contents
  1285.                before advancing the paper. 
  1286.             
  1287.             SEE ALSO
  1288.             
  1289.                SC_Advance
  1290.             
  1291.             EXAMPLE
  1292.             
  1293.             #include <stdio.h>
  1294.             #include <stdlib.h>
  1295.             #include "sc.h"
  1296.             
  1297.             int main(void)
  1298.             {
  1299.                int i;
  1300.                int error;
  1301.                double y;
  1302.                SC_WINDOW *traceWindow;
  1303.             
  1304.  
  1305.  
  1306.  
  1307.                                           20
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.                /* Initialize: 8.5 inch wide paper, 
  1314.                   plot speed = 1 inch/second */
  1315.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1316.                 &error);
  1317.             
  1318.                /* Add Trace Window 2.5" from top of paper, 
  1319.                   1.0" window height,
  1320.                   amplitude range from -1.0 to 1.0, display borders.
  1321.                */
  1322.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  1323.                   -2.0, 2.0, SCF_BORDER, &error);
  1324.             
  1325.                /* Draw a triangle wave of amplitude 2.0 */
  1326.                y = 2.0;
  1327.                for (i=0; i < 10; i++) /* 10 second plot */
  1328.                {
  1329.                   SC_Trace(traceWindow, y, &error);
  1330.                   y = y * -1.0;
  1331.                   SC_Draw();
  1332.                   SC_Advance(1.0); /* one second steps */
  1333.                }
  1334.             
  1335.                SC_Close();
  1336.                return 0;
  1337.             }
  1338.             
  1339.             
  1340.             
  1341.             SC_ErrorMsg
  1342.             ============================================================
  1343.             
  1344.                Returns an error message string.
  1345.             
  1346.             SYNTAX
  1347.             
  1348.                #include "sc.h"
  1349.                char *SC_ErrorMsg(int error);
  1350.             
  1351.             RETURN VALUE
  1352.             
  1353.                Pointer to an error message string.
  1354.             
  1355.             REMARKS
  1356.             
  1357.                  error [in] is an error code number.  A non-zero value
  1358.                  indicates an error occurred within the Strip Chart
  1359.                  Library.  It is recommended that your program terminate
  1360.                  or reinitializes itself if an error is detected;
  1361.                  unpredictable results could occur if you continue with
  1362.                  the program.
  1363.             
  1364.  
  1365.  
  1366.                                           21
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.             SEE ALSO
  1373.             
  1374.                SC_SetErrorTrap
  1375.             
  1376.             EXAMPLE
  1377.             
  1378.             #include <stdio.h>
  1379.             #include <stdlib.h>
  1380.             #include "sc.h"
  1381.             
  1382.             int main(void)
  1383.             {
  1384.                int error;
  1385.             
  1386.                /* Initialize: 8.5 inch wide paper, 
  1387.                   plot speed = 1 inch/second */
  1388.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1389.                 &error);
  1390.             
  1391.                if (error)
  1392.                {
  1393.                    printf("%s\n", SC_ErrorMsg(error))
  1394.                    return 1; /* abort program */
  1395.                 }
  1396.               
  1397.                /*
  1398.                      Program body
  1399.                         :
  1400.                         :
  1401.                */
  1402.             
  1403.                SC_Close();
  1404.                return 0;
  1405.             }
  1406.             
  1407.             
  1408.             
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.                                           22
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.             SC_Event
  1432.             ============================================================
  1433.             
  1434.                Sets the event level in an Event Window.
  1435.             
  1436.             SYNTAX
  1437.             
  1438.                #include "sc.h"
  1439.                void SC_Event(SC_WINDOW *eventWindow, int eventlevel, 
  1440.                  int *error);
  1441.             
  1442.             REMARKS
  1443.             
  1444.                  eventWindow [in] is a pointer to the Event Window.
  1445.             
  1446.                  eventLevel [in] is the new level (0 = low, 1 = high) to
  1447.                  display.
  1448.             
  1449.                  error [out] is a pointer to an error code.  A non-zero
  1450.                  error code indicates an error condition.
  1451.             
  1452.                Gaps may appear in the plot if SC_Event is called twice
  1453.                for the same Event Window without an intervening call to
  1454.                SC_Draw.
  1455.             
  1456.             SEE ALSO
  1457.             
  1458.                SC_AddEventWindow
  1459.             
  1460.             EXAMPLE
  1461.             
  1462.             #include <stdio.h>
  1463.             #include <stdlib.h>
  1464.             #include "sc.h"
  1465.             
  1466.             int main(void)
  1467.             {
  1468.                int i;
  1469.                int error;
  1470.                SC_WINDOW *eventWindow;
  1471.             
  1472.                /* Initialize: 8.5 inch wide paper,
  1473.                    plot speed = 1 inch/second */
  1474.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1475.                 &error);
  1476.             
  1477.                /* Add Event Window 0.5 from top of paper,
  1478.                   0.25 inch window height, 
  1479.                use pulse event markers
  1480.                */
  1481.                eventWindow = SC_AddEventWindow(0.5, 0.25, SCM_PULSE,
  1482.                 NO_FILL, &error);
  1483.  
  1484.                                           23
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.             
  1491.                /* Draw events */
  1492.                for (i=0; i < 10; i++) /* 10 second plot */
  1493.                {
  1494.                   if ((i%2) == 0)
  1495.                      SC_Event(eventWindow, 0, &error); /* set event low
  1496.                 */
  1497.                 */
  1498.                   else
  1499.                      SC_Event(eventWindow, 1, &error); /* set event high
  1500.                 */
  1501.                 */
  1502.             
  1503.                   SC_Draw();
  1504.                   SC_Advance(1.0); /* one second steps */
  1505.                }
  1506.             
  1507.                SC_Close();
  1508.                return 0;
  1509.             }
  1510.             
  1511.             
  1512.             
  1513.             SC_Init
  1514.             ============================================================
  1515.             
  1516.                Initializes the Strip Chart Library.
  1517.             
  1518.             SYNTAX
  1519.             
  1520.                #include "sc.h"
  1521.                void SC_Init(int port, unsigned char printerType,
  1522.                  unsigned char plotResolution, double units, 
  1523.                  double paperWidth, double plotSpeed, int *error);
  1524.             
  1525.             REMARKS
  1526.             
  1527.                  port [in] specifies the parallel port to which the
  1528.                  printer is attached, and is one of the following:
  1529.             
  1530.                  LPT1--parallel port 1.
  1531.                  LPT2--parallel port 2.
  1532.                  LPT3--parallel port 3.
  1533.             
  1534.                  printerType [in] specifies the type of printer.  The
  1535.                  following printer types are currently recognized:
  1536.             
  1537.                     EPS_9PIN -- Specifies Epson compatible 9-pin dot
  1538.                     matrix printers.
  1539.             
  1540.                     EPS_24PIN -- Specifies Epson compatible 24-pin dot
  1541.                     matrix printers.
  1542.  
  1543.                                           24
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.             
  1550.                  plotResolution [in] specifes the printer graphics mode
  1551.                  to be used and is one of the following:
  1552.             
  1553.                     LOW_RES -- Low resolution plots:
  1554.                     For 9 pin printers: 72 dpi  (horizontally) by 60 dpi
  1555.                     (vertically). For 24 pin printers: 180 dpi
  1556.                     (horizontally) by 180 dpi (vertically). 
  1557.             
  1558.                     HIGH_RES -- High resolution plots:
  1559.                     For 9 pin printers: 72 dpi (horizontally) by 240 dpi
  1560.                     (vertically).  For 24 pin printers: 180 dpi
  1561.                     (horizontally) by 360 dpi (vertically).
  1562.             
  1563.                  units [in] specifies the units of length measurement to
  1564.                  be used and is one of the following:
  1565.             
  1566.                     INCHES--Use inches as the unit of measurement.
  1567.                     CENTIMETERS--Use centimeters as the unit of
  1568.                     measurement.
  1569.                
  1570.                  paperWidth [in] specifies the paper width in inches or
  1571.                  centimeters.
  1572.             
  1573.                  plotSpeed [in] specifies the "plotting speed" in inches
  1574.                  (or centimeters) per second.  This parameter specifies
  1575.                  the relationship between the plotter horizontal
  1576.                  dimension (in inches or centimeters) and time (in
  1577.                  seconds).
  1578.             
  1579.                error [out] is a pointer to an error code.  A non-zero
  1580.                error code indicates an error condition.
  1581.             
  1582.             SEE ALSO
  1583.             
  1584.                SC_Close
  1585.             
  1586.             EXAMPLE
  1587.             
  1588.             #include <stdio.h>
  1589.             #include <stdlib.h>
  1590.             #include "sc.h"
  1591.             
  1592.             int main(void)
  1593.             {
  1594.                int error;
  1595.             
  1596.                /* Initialize: 8.5 inch wide paper, 
  1597.                plot speed = 1 inch/second */
  1598.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1599.                 &error);
  1600.             
  1601.  
  1602.                                           25
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.                /*
  1609.                      Program body
  1610.                         :
  1611.                         :
  1612.             
  1613.                */
  1614.             
  1615.                SC_Close();
  1616.                return 0;
  1617.             }
  1618.             
  1619.             
  1620.             
  1621.             SC_PrintChar
  1622.             ============================================================
  1623.             
  1624.                Low level function to send a character to the printer.
  1625.             
  1626.             SYNTAX
  1627.             
  1628.                #include "sc.h"
  1629.                void SC_PrintChar(char c);
  1630.             
  1631.             REMARKS
  1632.             
  1633.                  c [in] is the character or command code to send to the
  1634.                  printer attached to the parallel port specified with
  1635.                  the SC_Init function.  SC_Init must be called  before
  1636.                  using SC_PrintChar.
  1637.             
  1638.                SC_PrintChar is a low level function; do not use this
  1639.                function unless you are absolutely sure you know what you
  1640.                are doing!
  1641.             
  1642.             
  1643.             
  1644.             SC_PrinterReady
  1645.             ============================================================
  1646.             
  1647.                Checks if the printer is ready to accept data.
  1648.             
  1649.             SYNTAX
  1650.             
  1651.                #include "sc.h"
  1652.                int SC_PrinterReady(int port);
  1653.             
  1654.             RETURN VALUE
  1655.             
  1656.                SC_PrinterReady returns 1 if the printer is ready to
  1657.                receive data.  It returns zero if the printer is not
  1658.                ready.
  1659.             
  1660.  
  1661.                                           26
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.             REMARKS
  1668.             
  1669.                  port [in] specifies the parallel port to which the
  1670.                  printer is attached, and is one of the following:
  1671.             
  1672.                  LPT1--parallel port 1.
  1673.                  LPT2--parallel port 2.
  1674.                  LPT3--parallel port 3.
  1675.             
  1676.             EXAMPLE
  1677.             
  1678.             #include <stdio.h>
  1679.             #include <stdlib.h>
  1680.             #include "sc.h"
  1681.             int main(void)
  1682.             {
  1683.                int error;
  1684.             
  1685.                /* Check if printer ready */
  1686.                if (!SC_PrinterReady(LPT1))
  1687.                {
  1688.                   printf("Printer not ready!\n");
  1689.                   return 1; /* exit program */
  1690.                }
  1691.             
  1692.                /* Initialize: 8.5 inch wide paper, 
  1693.                 plot speed = 1 inch/second */
  1694.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1695.                 &error);
  1696.             
  1697.                /*
  1698.                      Program body
  1699.             
  1700.                         :
  1701.                         :
  1702.             
  1703.                */
  1704.             
  1705.                SC_Close();
  1706.                return 0;
  1707.             }
  1708.             
  1709.             
  1710.             
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                           27
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.             SC_SetErrorTrap
  1727.             ============================================================
  1728.             
  1729.                Sets up a function to process errors..
  1730.             
  1731.             SYNTAX
  1732.             
  1733.                #include "sc.h"
  1734.                void SC_SetErrorTrap(void (*func)(char *msg));
  1735.             
  1736.             REMARKS
  1737.             
  1738.                  func [in] is a pointer to a function that is called
  1739.                  when an error occurs in the Strip Chart Library.  func
  1740.                  is passed a pointer to an error message string.  It is
  1741.                  recommended that your program terminate or
  1742.                  reinitializes itself if an error is detected;
  1743.                  unpredictable results could occur if you continue with
  1744.                  the program.
  1745.             
  1746.             SEE ALSO
  1747.             
  1748.                SC_ErrorMsg
  1749.             
  1750.             EXAMPLE
  1751.             
  1752.             #include <stdio.h>
  1753.             #include <stdlib.h>
  1754.             #include "sc.h"
  1755.             
  1756.             void ErrorTrapFunc(char *msg)
  1757.             { /* user function to trap errors */
  1758.                printf("%s\n",msg); /* display error message */
  1759.                exit(1); /* abort program and exit */
  1760.             }
  1761.             
  1762.             int main(void)
  1763.             {
  1764.                int error;
  1765.             
  1766.                SC_SetErrorTrap(ErrorTrapFunc);
  1767.             
  1768.                /* Initialize: 8.5 inch wide paper, 
  1769.                   plot speed = 1 inch/second */
  1770.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1771.                 &error);
  1772.             
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.                                           28
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.                /*
  1786.                      Program body
  1787.                         :
  1788.                         :
  1789.             
  1790.                */
  1791.             
  1792.                SC_Close();
  1793.                return 0;
  1794.             }
  1795.             
  1796.             
  1797.             
  1798.             SC_SetHorizontalGrids
  1799.             ============================================================
  1800.             
  1801.                Specifies the number of horizontal grid lines in Trace
  1802.                Windows.  This function only affects Trace Windows added
  1803.                after calling this function.
  1804.             
  1805.             SYNTAX
  1806.             
  1807.                #include "sc.h"
  1808.                void SC_SetHorizontalGrids(int divisions, int *error);
  1809.             
  1810.             REMARKS
  1811.             
  1812.                  divisions [in] is the number of horizontal divisions. 
  1813.                  The number of horizontal grid lines drawn is equal to
  1814.                  divisions minus 1.
  1815.             
  1816.                  error [out] is a pointer to an error code.  A non-zero
  1817.                  error code indicates an error condition.
  1818.             
  1819.             SEE ALSO
  1820.             
  1821.                SC_AddTraceWindow
  1822.             
  1823.             EXAMPLE
  1824.             
  1825.             #include <stdio.h>
  1826.             #include <stdlib.h>
  1827.             #include "sc.h"
  1828.             
  1829.             int main(void)
  1830.             {
  1831.                int i;
  1832.                int error;
  1833.                double y;
  1834.                SC_WINDOW *traceWindow;
  1835.             
  1836.  
  1837.  
  1838.                                           29
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                /* Initialize: 8.5 inch wide paper, 
  1845.                   plot speed = 1 inch/second */
  1846.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1847.                 &error);
  1848.             
  1849.                /* Set timing (vertical) grids to be 1 second apart. */
  1850.                SC_SetTimeGrids(1.0, &error);
  1851.             
  1852.                /* Set Y label format; display at 2.0 second intervals.
  1853.                */
  1854.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  1855.             
  1856.                /* Divide trace into 4 equal sections. */
  1857.                SC_SetHorizontalGrids(4, &error);
  1858.             
  1859.                /* Add Trace Window 2.5" from top of paper, 1.0" window
  1860.                   height, amplitude range from -1.0 to 1.0, display
  1861.                   borders, display grids, label Y axis.
  1862.                */
  1863.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  1864.                   -2.0, 2.0, SCF_BORDER | SCF_GRID | SCF_YLABEL,
  1865.                   &error);
  1866.             
  1867.                /* Draw a triangle wave of amplitude 2.0 */
  1868.                y = 2.0;
  1869.                for (i=0; i < 10; i++) /* 10 second plot */
  1870.                {
  1871.                   SC_Trace(traceWindow, y, &error);
  1872.                   y = y * -1.0;
  1873.                   SC_Draw();
  1874.                   SC_Advance(1.0); /* one second steps */
  1875.                }
  1876.             
  1877.                SC_Close();
  1878.                return 0;
  1879.             }
  1880.             
  1881.             
  1882.             
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.                                           30
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.             SC_SetTimeGrids
  1904.             ============================================================
  1905.             
  1906.                Specifies the time interval between vertical grid lines
  1907.                in Trace Windows.  This function only affects Trace
  1908.                Windows added after calling this function.
  1909.             
  1910.             SYNTAX
  1911.             
  1912.                #include "sc.h"
  1913.                void SC_SetTimeGrids(double interval, int *error);
  1914.             
  1915.             REMARKS
  1916.             
  1917.                  interval [in] is the time interval (in seconds) between
  1918.                  vertical grid lines.
  1919.             
  1920.                  error [out] is a pointer to an error code.  A non-zero
  1921.                  error code indicates an error condition.
  1922.             
  1923.             SEE ALSO
  1924.             
  1925.                SC_AddTraceWindow
  1926.             
  1927.             EXAMPLE
  1928.             
  1929.             #include <stdio.h>
  1930.             #include <stdlib.h>
  1931.             #include "sc.h"
  1932.             
  1933.             int main(void)
  1934.             {
  1935.                int i;
  1936.                int error;
  1937.                double y;
  1938.                SC_WINDOW *traceWindow;
  1939.             
  1940.                /* Initialize: 8.5 inch wide paper, 
  1941.                   plot speed = 1 inch/second */
  1942.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  1943.                 &error);
  1944.             
  1945.                /* Set timing (vertical) grids to be 1 second apart. */
  1946.                SC_SetTimeGrids(1.0, &error);
  1947.             
  1948.                /* Set Y label format; display at 2.0 second intervals.
  1949.                 */
  1950.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  1951.             
  1952.                /* Divide trace into 4 equal sections. */
  1953.                SC_SetHorizontalGrids(4, &error);
  1954.             
  1955.  
  1956.                                           31
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.                /* Add Trace Window 2.5" from top of paper, 1.0" window
  1963.                   height, amplitude range from -1.0 to 1.0, display
  1964.                   borders, display grids, label Y axis.
  1965.                */
  1966.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  1967.                   -2.0, 2.0, SCF_BORDER | SCF_GRID | SCF_YLABEL,
  1968.                   &error);
  1969.             
  1970.                /* Draw a triangle wave of amplitude 2.0 */
  1971.                y = 2.0;
  1972.                for (i=0; i < 10; i++) /* 10 second plot */
  1973.                {
  1974.                   SC_Trace(traceWindow, y, &error);
  1975.                   y = y * -1.0;
  1976.                   SC_Draw();
  1977.                   SC_Advance(1.0); /* one second steps */
  1978.                }
  1979.             
  1980.                SC_Close();
  1981.                return 0;
  1982.             }
  1983.             
  1984.             
  1985.             
  1986.             SC_SetTraceRange
  1987.             ============================================================
  1988.             
  1989.                Changes the minimum and maximum real world coordinates of
  1990.                a Trace Window.   A thick vertical line is automatically
  1991.                drawn at the current time position to indicate the
  1992.                change.
  1993.             
  1994.             SYNTAX
  1995.             
  1996.                #include "sc.h"
  1997.                void SC_SetTraceRange(SC_WINDOW *traceWindow, 
  1998.                  double ymin, double ymax, int *error);
  1999.             
  2000.             REMARKS
  2001.             
  2002.                  traceWindow [in] is a pointer to the Trace Window.
  2003.             
  2004.                  ymin [in] is the new real world Y coordinate which
  2005.                  corresponds to the bottom border of the trace window.
  2006.             
  2007.                  ymax [in] is the new real world Y coordinate which
  2008.                  corresponds to the top border of the trace window.
  2009.             
  2010.                  error [out] is a pointer to an error code.  A non-zero
  2011.                  error code indicates an error condition.
  2012.             
  2013.  
  2014.  
  2015.                                           32
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.             SEE ALSO
  2022.             
  2023.                SC_AddTraceWindow
  2024.             
  2025.             EXAMPLE
  2026.             
  2027.             #include <stdio.h>
  2028.             #include <stdlib.h>
  2029.             #include "sc.h"
  2030.             
  2031.             int main(void)
  2032.             {
  2033.                int i;
  2034.                int error;
  2035.                double y;
  2036.                SC_WINDOW *traceWindow;
  2037.             
  2038.                /* Initialize: 8.5 inch wide paper,
  2039.                   plot speed = 1 inch/second */
  2040.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2041.                 &error);
  2042.             
  2043.                /* Set timing (vertical) grids to be 1 second apart. */
  2044.                SC_SetTimeGrids(1.0, &error);
  2045.             
  2046.                /* Set Y label format; display at 2.0 second intervals.
  2047.                */
  2048.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  2049.             
  2050.                /* Divide trace into 4 equal sections. */
  2051.                SC_SetHorizontalGrids(4, &error);
  2052.             
  2053.                /* Add Trace Window 4" from top of paper, 
  2054.                   1" window height, amplitude range is initially from -2.0
  2055.                   to 2.0, display borders, display grids, label Y axis.
  2056.                */
  2057.                traceWindow = SC_AddTraceWindow(4.0, 1.0, -2.0, 2.0,
  2058.                   SCF_BORDER | SCF_GRID | SCF_YLABEL, &error);
  2059.             
  2060.                /* Draw a triangle wave of amplitude 2.0 */
  2061.                y = 2.0;
  2062.                for (i=0; i < 10; i++) /* 10 second plot */
  2063.                {
  2064.                   SC_Trace(traceWindow, y, &error);
  2065.             
  2066.                   y = y * -1.0; /* triangle wave */
  2067.             
  2068.                   SC_Draw();
  2069.                   SC_Advance(1.0); /* one second steps */
  2070.             
  2071.                   /* Change the window amplitude range to -4.0 to 4.0 at
  2072.                      time = 5.0 seconds.
  2073.  
  2074.                                           33
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.                    */
  2081.                   if (i == 5)
  2082.                      SC_SetTraceRange(traceWindow, -4.0, 4.0, &error);
  2083.                }
  2084.             
  2085.                SC_Close();
  2086.                return 0;
  2087.             }
  2088.             
  2089.             
  2090.             
  2091.             SC_SetYlabels
  2092.             ============================================================
  2093.             
  2094.                Specifies the label format of  the vertical axis in Trace
  2095.                Windows.  This function only affects Trace Windows added
  2096.                after calling this function.
  2097.             
  2098.             SYNTAX
  2099.             
  2100.                #include "sc.h"
  2101.                void SC_SetYlabels(double charHeight, char *format,
  2102.                  double interval, int *error);
  2103.             
  2104.             REMARKS
  2105.             
  2106.                  charHeight [in] is the character height (in inches or
  2107.                  centimeters).
  2108.             
  2109.                  format [in] is a C printf format string to be used for
  2110.                  the vertical axis labels.  Use floating point
  2111.                  specifiers in the format string, for example: "%9.3f"
  2112.                  or "%+10.4e".  To display labels as integers, use 
  2113.                  "%-1.0f".
  2114.             
  2115.                  interval [in] is the time interval (in seconds) between
  2116.                  displaying the labels.
  2117.             
  2118.                  error [out] is a pointer to an error code.  A non-zero
  2119.                  error code indicates an error condition.
  2120.             
  2121.             SEE ALSO
  2122.             
  2123.                SC_AddTraceWindow
  2124.             
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.                                           34
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.             EXAMPLE
  2140.             
  2141.             #include <stdio.h>
  2142.             #include <stdlib.h>
  2143.             #include "sc.h"
  2144.             
  2145.             int main(void)
  2146.             {
  2147.                int i;
  2148.                int error;
  2149.                double y;
  2150.                SC_WINDOW *traceWindow;
  2151.             
  2152.                /* Initialize: 8.5 inch wide paper,
  2153.                   plot speed = 1 inch/second */
  2154.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2155.                 &error);
  2156.             
  2157.                /* Set timing (vertical) grids to be 1 second apart. */
  2158.                SC_SetTimeGrids(1.0, &error);
  2159.             
  2160.                /* Set Y label format; 10 point character height; 
  2161.                   display at 2.0 second intervals. */
  2162.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  2163.             
  2164.                /* Divide trace into 4 equal sections. */
  2165.                SC_SetHorizontalGrids(4, &error);
  2166.             
  2167.                /* Add Trace Window 2.5" from top of paper, 
  2168.                   1.0" window height, amplitude range from -1.0 to 1.0,
  2169.                   display borders, display grids, label Y axis.
  2170.                */
  2171.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  2172.                   -2.0, 2.0, SCF_BORDER | SCF_GRID | SCF_YLABEL,
  2173.                   &error);
  2174.             
  2175.                /* Draw a triangle wave of amplitude 2.0 */
  2176.                y = 2.0;
  2177.                for (i=0; i < 10; i++) /* 10 second plot */
  2178.                {
  2179.                   SC_Trace(traceWindow, y, &error);
  2180.                   y = y * -1.0;
  2181.                   SC_Draw();
  2182.                   SC_Advance(1.0); /* one second steps */
  2183.                }
  2184.             
  2185.                SC_Close();
  2186.                return 0;
  2187.             }
  2188.             
  2189.             
  2190.             
  2191.  
  2192.                                           35
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.             SC_Text
  2199.             ============================================================
  2200.             
  2201.                Displays a text string in a Text Window.
  2202.             
  2203.             SYNTAX
  2204.             
  2205.                #include "sc.h"
  2206.                void SC_Text(SC_WINDOW *textWindow, char *string, 
  2207.                  int *error);
  2208.             
  2209.             REMARKS
  2210.             
  2211.                  textWindow [in] is a pointer to the Text Window in
  2212.                  which to display the string.
  2213.             
  2214.                  string [in] is the ASCII text string to display.
  2215.             
  2216.                  error [out] is a pointer to an error code.  A non-zero
  2217.                  error code indicates an error condition.
  2218.             
  2219.                Calling SC_Text for a Text Window that has not yet
  2220.                finished printing the string from a previous call to
  2221.                SC_Text will cause the two strings to be printed over
  2222.                each other.
  2223.             
  2224.             SEE ALSO
  2225.             
  2226.                SC_AddTextWindow
  2227.             
  2228.             EXAMPLE
  2229.             
  2230.             #include <stdio.h>
  2231.             #include <stdlib.h>
  2232.             #include "sc.h"
  2233.             
  2234.             int main(void)
  2235.             {
  2236.                int i;
  2237.                int error;
  2238.                SC_WINDOW *textWindow;
  2239.             
  2240.                /* Initialize: 8.5 inch wide paper, 
  2241.                   plot speed = 1 inch/second */
  2242.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2243.                 &error);
  2244.             
  2245.                if (error)
  2246.                {
  2247.                   printf("%s\n",SC_ErrorMsg(error));
  2248.                   return 1; /* exit */
  2249.                }
  2250.  
  2251.                                           36
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.             
  2258.                /* Add Text Window 1.5" from top of paper, 
  2259.                   0.25" window height
  2260.                */
  2261.                textWindow = SC_AddTextWindow(1.5, 0.25, &error);
  2262.             
  2263.                /* Draw */
  2264.                for (i=0; i < 10; i++) /* 10 second plot */
  2265.                {
  2266.                   /* Display "hello world" every 2 seconds */
  2267.                   if ((i%2) == 0)
  2268.                      SC_Text(textWindow,"Hello World!",&error);
  2269.                   SC_Draw();
  2270.                   SC_Advance(1.0); /* one second steps */
  2271.                }
  2272.             
  2273.                SC_Close();
  2274.                return 0;
  2275.             }
  2276.             
  2277.             
  2278.             
  2279.             SC_Title
  2280.             ============================================================
  2281.             
  2282.                Specifies the title string for a Title Window.
  2283.             
  2284.             SYNTAX
  2285.             
  2286.                #include "sc.h"
  2287.                void SC_Title(SC_WINDOW *titleWindow, char *titleString,
  2288.                  int *error);
  2289.             
  2290.             REMARKS
  2291.             
  2292.                  titleWindow [in] is a pointer to the Title Window in
  2293.                  which to display the string.
  2294.             
  2295.                  titleString [in] is a pointer to a text string.
  2296.             
  2297.                  error [out] is a pointer to an error code.  A non-zero
  2298.                  error code indicates an error condition.
  2299.             
  2300.             SEE ALSO
  2301.             
  2302.                SC_AddTitleWindow
  2303.             
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.                                           37
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.             EXAMPLE
  2317.             
  2318.             #include <stdio.h>
  2319.             #include <stdlib.h>
  2320.             #include "sc.h"
  2321.             
  2322.             int main(void)
  2323.             {
  2324.                int i;
  2325.                int error;
  2326.                SC_WINDOW *titleWindow;
  2327.             
  2328.                /* Initialize: 8.5 inch wide paper, 
  2329.                   plot speed = 1 inch/second */
  2330.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2331.                 &error);
  2332.             
  2333.                /* Add Title Window 5.5" from top of paper, 
  2334.                 0.25" window height, display every 2.0 seconds
  2335.                */
  2336.                titleWindow = SC_AddTitleWindow(5.5, 0.25, 2.0, &error);
  2337.             
  2338.                /* Set title string. */
  2339.                SC_Title(titleWindow, "Hello World!", &error);
  2340.             
  2341.                /* Draw */
  2342.                for (i=0; i < 10; i++) /* 10 second plot */
  2343.                {
  2344.                   SC_Draw();
  2345.                   SC_Advance(1.0); /* one second steps */
  2346.                }
  2347.             
  2348.                SC_Close();
  2349.                return 0;
  2350.             }
  2351.             
  2352.             
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.                                           38
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.             
  2376.             SC_Trace
  2377.             ============================================================
  2378.             
  2379.                Sets the current trace amplitude in a Trace Window.
  2380.             
  2381.             SYNTAX
  2382.             
  2383.                #include "sc.h"
  2384.                void SC_Trace(SC_WINDOW *traceWindow, double y, 
  2385.                  int *error);
  2386.             
  2387.             REMARKS
  2388.             
  2389.                  traceWindow [in] is a pointer to the Trace Window.
  2390.             
  2391.                  y [in] is the current trace amplitude in the same real
  2392.                  world units as the window limits, ymin and ymax,
  2393.                  specified in the SC_AddTraceWindow function.  When you
  2394.                  call SC_Draw, a line will be drawn between the last two
  2395.                  points in the Trace Window set by the last two calls to
  2396.                  SC_Trace.
  2397.             
  2398.                  error [out] is a pointer to an error code.  A non-zero
  2399.                  error code indicates an error condition.
  2400.             
  2401.                Gaps may appear in the trace plot if SC_Trace is called
  2402.                twice for the same Trace Window without an intervening
  2403.                call to SC_Draw.
  2404.             
  2405.             SEE ALSO
  2406.             
  2407.                SC_AddTraceWindow, SC_SetTraceRange
  2408.             
  2409.             EXAMPLE
  2410.             
  2411.             #include <stdio.h>
  2412.             #include <stdlib.h>
  2413.             #include "sc.h"
  2414.             
  2415.             int main(void)
  2416.             {
  2417.                int i;
  2418.                int error;
  2419.                double y;
  2420.                SC_WINDOW *traceWindow;
  2421.             
  2422.                /* Initialize: 8.5 inch wide paper, 
  2423.                   plot speed = 1 inch/second */
  2424.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2425.                 &error);
  2426.             
  2427.  
  2428.                                           39
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.                /* Set timing (vertical) grids to be 1 second apart. */
  2435.                SC_SetTimeGrids(1.0, &error);
  2436.             
  2437.                /* Set Y label format; display at 2.0 second intervals.
  2438.                */
  2439.                SC_SetYlabels(10.0/72.0, "%+0.1f", 2.0, &error);
  2440.             
  2441.                /* Divide trace into 4 equal sections. */
  2442.                SC_SetHorizontalGrids(4, &error);
  2443.             
  2444.                /* Add Trace Window 2.5" from top of paper, 
  2445.                   1.0" window height, amplitude range from -1.0 to 1.0,
  2446.                   display borders, display grids, label Y axis.
  2447.                */
  2448.                traceWindow = SC_AddTraceWindow(2.5, 1.0,
  2449.                   -2.0, 2.0, SCF_BORDER | SCF_GRID | SCF_YLABEL,
  2450.                 &error);
  2451.             
  2452.                /* Draw a triangle wave of amplitude 2.0 */
  2453.                y = 2.0;
  2454.                for (i=0; i < 10; i++) /* 10 second plot */
  2455.                {
  2456.                   SC_Trace(traceWindow, y, &error);
  2457.                   y = y * -1.0;
  2458.                   SC_Draw();
  2459.                   SC_Advance(1.0); /* one second steps */
  2460.                }
  2461.             
  2462.                SC_Close();
  2463.                return 0;
  2464.             }
  2465.             
  2466.             
  2467.             
  2468.             SC_yoffset
  2469.             ============================================================
  2470.             
  2471.                Global variable which keeps track of the page offset of
  2472.                the bottom border of the last window added.
  2473.             
  2474.             SYNTAX
  2475.             
  2476.                #include "sc.h"
  2477.                extern double SC_yoffset;
  2478.             
  2479.             REMARKS
  2480.             
  2481.                SC_yoffset provides an easy way to add windows
  2482.                sequentially to the strip chart.  Initially, SC_yoffset
  2483.                is set to zero (the top of the page).  When you add a
  2484.                window, SC_yoffset is set to the bottom of the window,
  2485.                that is, SC_yoffset is set to yoffset + yheight, where
  2486.  
  2487.                                           40
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.                yoffset is the window offset from the top of the page and
  2494.                yheight is the window height.
  2495.             
  2496.             EXAMPLE
  2497.             
  2498.             #include <stdio.h>
  2499.             #include <stdlib.h>
  2500.             #include "sc.h"
  2501.             
  2502.             int main(void)
  2503.             {
  2504.                int i;
  2505.                int error;
  2506.                SC_WINDOW *titleWindow;
  2507.                SC_WINDOW *traceWindow1, *traceWindow2, *traceWindow3;
  2508.             
  2509.                /* Initialize: 8.5 inch wide paper,
  2510.                   plot speed = 1 inch/second */
  2511.                SC_Init(LPT1, SC_24PIN, SC_LOW_RES, INCHES, 8.5, 1.0,
  2512.                 &error);
  2513.             
  2514.                /* Add Title Window 0.5" from top of paper, 
  2515.                   0.25" window height, display every 2.0 seconds
  2516.                */
  2517.                titleWindow = SC_AddTitleWindow(SC_yoffset+0.5, 0.25,
  2518.                 2.0, &error);
  2519.             
  2520.                /* Add three trace windows, each 1.0" high with 0.25"
  2521.                   spacing between windows */
  2522.                traceWindow1 = SC_AddTraceWindow(SC_yoffset+0.25, 1.0,
  2523.                   -2.0, 2.0, SCF_NO_FLAGS, &error);
  2524.                traceWindow2 = SC_AddTraceWindow(SC_yoffset+0.25, 1.0,
  2525.                   -2.0, 2.0, SCF_NO_FLAGS, &error);
  2526.                traceWindow3 = SC_AddTraceWindow(SC_yoffset+0.25, 1.0,
  2527.                   -2.0, 2.0, SCF_NO_FLAGS, &error);
  2528.             
  2529.                /* 
  2530.                Program Body
  2531.                :
  2532.                :
  2533.                */
  2534.             
  2535.                SC_Close();
  2536.                return 0;
  2537.             }
  2538.             
  2539.             
  2540.             
  2541.               
  2542.  
  2543.  
  2544.  
  2545.  
  2546.                                           41
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.             
  2554.                                   C H A P T E R   4
  2555.             
  2556.                                     Error Messages
  2557.             
  2558.             
  2559.             
  2560.             This chapter lists the error messages returned by function
  2561.             SC_ErrorMsg.
  2562.             
  2563.             Out of memory
  2564.                The system has run out of memory.  Try using the large
  2565.                memory model for your compiler.
  2566.             
  2567.             Incorrect window type for this function
  2568.                You  passed a pointer (SC_WINDOW *) to a window that is
  2569.                inappropriate for this function.  For example,  function
  2570.                SC_Text accepts only pointers to Text Windows; passing a
  2571.                Trace Window pointer to SC_Text will generate this error.
  2572.             
  2573.             YMIN equals YMAX
  2574.                You passed the same numerical value for arguments ymin
  2575.                and ymax to functions SC_AddTraceWindow and
  2576.                SC_SetTraceRange.
  2577.             
  2578.             Window offset must be greater than zero
  2579.                The value of argument yoffset must be greater than zero
  2580.                when calling functions SC_Add???Window.
  2581.             
  2582.             Window height must be greater than zero
  2583.                The value of argument yheight must be greater than zero
  2584.                when calling functions SC_Add???Window.
  2585.             
  2586.             Invalid printer type/resolution
  2587.                You passed invalid values for arguments printerType
  2588.                and/or plotResolution to function SC_Init.
  2589.             
  2590.             Time interval must be greater than zero
  2591.                You passed a time interval argument that is less than or
  2592.                equal to zero.  All time interval arguments must be
  2593.                greater than zero.
  2594.             
  2595.             Number of divisions must be greater than zero
  2596.                You passed a number of horizontal or vertical grid
  2597.                divisions argument that is less than or equal to zero. 
  2598.                The number of horizontal or vertical grid divisions must
  2599.                be greater than zero.
  2600.             
  2601.             String is a null pointer
  2602.                You passed a NULL pointer for a string argument.  Use an
  2603.                empty string ("") to pass a null string.
  2604.  
  2605.                                           42
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.             
  2612.             Character height must be greater than zero
  2613.                The value of argument charHeight must be greater than
  2614.                zero in function SC_SetYlabels.
  2615.             
  2616.             
  2617.             
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.                                           43
  2665.